//
// main.cpp for 206observ in /home/morel_t//Rendu/maths/206observ
// 
// Made by thomas morel
// Login   <morel_t@epitech.net>
// 
// Started on  Mon May  7 09:52:07 2012 thomas morel
// Last update Mon May  7 14:37:54 2012 thomas morel
//

#include	<iostream>
#include	"File.hh"
#include	"Table.hh"

int		main(int ac, char **av)
{
  if (ac != 2)
    {
      std::cerr << "Usage: ./206observ <file.txt>" << std::endl;
      return (-1);
    }

  File		file(av[1]);
  Table		values(file.getLines());

  if (!values.checkFile(file.getLines()))
    {
      std::cerr << "[ERROR] " << file.getFilename() << " is wrong." << std::endl;
      return (-1);
    }

  std::cout.precision(3);
  std::cout.setf(std::ios::fixed, std::ios::floatfield);
  std::cout << std::endl << "\t  \033[31;01m" << file.getFilename() << "\033[0m" << std::endl << std::endl;
  std::cout << " Moyenne Arithmetique : " << values.moyenneArithmetique() << std::endl;
  std::cout << "  Moyenne Quadratique : " << values.moyenneQuadratique() << std::endl;
  std::cout << "  Moyenne Geometrique : " << values.moyenneGeometrique() << std::endl;
  std::cout << "   Moyenne Harmonique : " << values.moyenneHarmonique() << std::endl;
  std::cout << "              Mediane : " << values.mediane() << std::endl;
  std::cout << "                 Mode : " << values.mode() << std::endl;
  std::cout << "             Variance : " << values.variance() << std::endl;
  std::cout << "           Ecart-type : " << values.ecartType() << std::endl;
  std::cout << "          Ecart Moyen : " << values.ecartMoyen() << std::endl;
  std::cout << "         Ecart Median : " << values.ecartMedian() << std::endl << std::endl;
  return (0);
}
